{extend name="$_admin_base_layout" /} {block name="body"}
<div class="container-fluid" style="padding-top: 10px; background-color: rgb(240, 242, 245);">
    <div class="panel panel-container">
        <div class="panel-body">
            <form class="form-inline form-search">
                <div class="form-group">
                    <label>配置分组：</label>
                    {html:select name="group" options="#config_group_list" selected="group" clazz="form-control" first="全部"/}
                </div>
                <div class="form-group">
                    <label>配置类型：</label>
                    {html:select name="type" options="#config_type_list" selected="type" clazz="form-control" first="全部"/}
                </div>

                <div class="form-group">
                    <label>标识/标题：</label>
                    <input type="text" class="form-control" name="title" value="{$title|default=''}">
                </div>
                <button type="submit" class="btn btn-primary">查询</button>
                <button type="button" class="btn btn-default btn-reset">重置</button>
            </form>
        </div>
        <!-- 数据表格 -->
        <table class="table table-sorter">
            <!-- 表头 -->
            <thead>
            <tr>
                <th style="width: 20px;">#</th>
                <th>配置标识</th>
                <th>配置标题</th>
                <th>配置分组</th>
                <th>配置类型</th>
                <th>排序</th>
                <th>最后更新</th>
                <th style="width: 80px;">状态</th>
                <th style="width: 120px;">操作</th>
            </tr>
            </thead>
            <!-- 列表 -->
            <tbody>
            {notempty name="data_list"} {volist name="data_list" id="info"}
            <tr>
                <td>{$i}</td>
                <td>{$info.name}</td>
                <td>{$info.title}</td>
                <td>{$info.group_text}</td>
                <td>{$info.type_text}</td>
                <td>{$info.sort}</td>
                <td>{$info.update_time|date='Y-m-d H:m'}</td>
                <td>{$info.status_text|raw}</td>
                <td>
                    {html:auth name='admin/config/edit'}
                    <a href="{:url('edit',array('id'=>$info['id']))}" data-toggle="modal" data-icon="edit"
                       data-size="lg" data-backdrop="static" data-title="编辑配置">编辑</a>
                    {/html:auth}
                    {eq name="info['status']" value="0"}
                    {html:auth name="admin/config/resume"}
                    <a href="{:url('resume',array('id'=>$info['id']))}" class="confirm ajax-get">启用</a>
                    {/html:auth}
                    {else/}
                    {html:auth name="admin/config/forbid"}
                    <a href="{:url('forbid',array('id'=>$info['id']))}" class="confirm ajax-get text-warning">禁用</a>
                    {/html:auth}
                    {/eq}
                    {html:auth name='admin/config/delete'}
                    <a href="{:url('delete',array('id'=>$info['id']))}" class="confirm ajax-get text-danger">删除</a>
                    {/html:auth}
                </td>
            </tr>
            {/volist} {else/}
            <tr>
                <td class="text-center" colspan="9">aOh! 暂时还没有内容!</td>
            </tr>
            {/notempty}
            </tbody>
            <tfoot>
            <tr>
                <td colspan="9">
                    {$pager||raw}
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
{/block}

{block name="sub_menu_action"}
<ul class="nav nav-pills" style="margin-right: 10px;">
    {html:auth name='admin/config/add'}
    <li>
        <a href="{:url('add')}" class="btn btn-link" data-toggle="modal" data-icon="plus" data-backdrop="static"
           data-title="新增配置" data-size="lg"><i class="icon-plus"></i> 新增
        </a>
    </li>
    {/html:auth}
    {html:auth name='admin/config/sort'}
    <li>
        <a href="{:url('sort', array('group'=>$group))}" id="btn-sort" class="btn btn-link" data-value="{$group}"
           data-toggle="modal" data-icon="sort-by-alphabet" data-backdrop="static" data-title="配置排序">
            <i class="icon-sort-by-alphabet"></i> 排序
        </a>
    </li>
    {/html:auth}

</ul>
{/block}

{block name="script"}
<script>
    $(function () {
        $('#btn-sort').click(function () {
            //$(this).addClass('disabled');
            var group = $(this).attr('data-value');
            if (group == '') {
                new $.zui.Messager('请选择配置分组查询后在点击排序按钮', {
                    placement: 'top',
                    type: 'danger'
                }).show();
                setTimeout(function () {
                    $('#btn-sort').removeClass('disabled');
                }, 1500);
                return false;
            }
        });
    });
</script>
{/block}
